-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: warn Series.interpolate(method='index') with unsorted index #29887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: warn Series.interpolate(method='index') with unsorted index #29887
Conversation
…with-unsorted-index-gh21037
…with-unsorted-index-gh21037
Can this be fixed instead of producing a warning? |
Yes it can, in the cost of introducing dependency on scipy. (like other interpolate methods) |
We can't use |
You mean we sort it, interpolate, then fill it back? this may leads to undefined behavior for duplicated indexes, better leaves the responsibility to scipy IMHO. 😂 |
then would just raise rather than a warning. |
So the preferred approach would be stick to |
i think either we sort then reorder to get the original |
Series.interpolate(method='index')
usenumpy.interp
under the hood, which, from numpy doc, Does not check that the x-coordinate sequence xp is increasing. If xp is not increasing, the results are nonsense. (link)Here adds a warning to warn the user about this.
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff